#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: source.py 
@version:
@time: 2022/05/31 
"""
from TapClientCore.T04_logic.DagNew.node.node_base import NodeBase


class CloneSource(NodeBase):
    node = None

    def __init__(self, init_info):
        self.init(init_info)

    def init(self, init_info):
        name = init_info.get('name')
        database_type = init_info.get('database_type')
        connection_id =  self.get_connection_id_by_name(name)

        clone_svg = self.clone_svg(database_type)
        node = {
            'id': self.newId,
            'name': name,
            'type': 'database',
            'connectionId': connection_id,
            'database_type': database_type,

            'charset': '',
            'dropType': 'no_drop',
            'shapeImage': f'static/editor/{clone_svg}',
            'readBatchSize': 1000,
            'readCdcInterval': 500,

            'removeAllTables': False,
            'syncObjects': [],
            'field_process': [],
            'includeTables': [],
            'inputLanes': [],

            'outputLanes': [],
            'table_prefix': '',
            'table_suffix': '',
            'isChangeConnectionFlag': False,
            'mqType': init_info.get('mqType', ''),
        }
        self.node = node